<%@page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<html>
<head>
    <title>门诊查询--理博软件2016</title>
    <meta charset="UTF-8">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/Css/bootstrap.css" />
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/Css/bootstrap-responsive.css" />
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/Css/style.css" />
    <script type="text/javascript" src="${pageContext.request.contextPath}/Js/jquery.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/Js/jquery.sorted.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/Js/bootstrap.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/Js/ckform.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/Js/common.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/My97DatePicker/WdatePicker.js"></script>

    <style type="text/css">
        body {
            padding-bottom: 40px;
        }
        .sidebar-nav {
            padding: 9px 0;
        }

        @media (max-width: 980px) {
            /* Enable use of floated navbar text */
            .navbar-text.pull-right {
                float: none;
                padding-left: 5px;
                padding-right: 5px;
            }
        }


    </style>
    <script type="text/javascript">
        $(function () {
            $('#newNav').click(function(){
                window.location.href="add.html";
            });
        });

        function checkall(){
            var alls=document.getElementsByName("check");
            var ch=document.getElementById("checkall");
            if(ch.checked){
                for(var i=0;i<alls.length;i++){
                    alls[i].checked=true;
                }
            }else{
                for(var i=0;i<alls.length;i++){
                    alls[i].checked=false;
                }
            }
        }
        function delAll(){
            var alls=document.getElementsByName("check");
            var ids=new Array();
            for(var i=0;i<alls.length;i++){
                if(alls[i].checked){
                    ids.push(alls[i].value);
                }
            }
            if(ids.length>0){
                if(confirm("确认操作?")){
                    alert("成功!");
                }
            }else{
                alert("请选中要操作的项");
            }
        }
    </script>
</head>
<body>

<form action="${pageContext.request.contextPath}/registrationServlet" method="post"
      class="definewidth m20">
    <table class="table table-bordered table-hover definewidth m10">
        <input type="hidden" name="mark" value="selectRegistration"/>
        <tr>
            <td width="10%" class="tableleft">病历号：</td>
            <td><input type="text" name="rid" value="${registrationVo.rid}"/></td>

            <td width="10%" class="tableleft">主治医生：</td>
            <td><input type="text" name="dname" value="${registrationVo.dname}"/></td>
        </tr>
        <tr>

            <td width="10%" class="tableleft">挂号时间：</td>

            <td colspan="5">
                <input type="text" name="startTime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd  HH:mm:ss'})" class="Wdate" value="${registrationVo.startTime}"/>&nbsp;至&nbsp;
                <input type="text" name="endTime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="Wdate" value="${registrationVo.endTime}"/>
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <button type="submit" class="btn btn-primary" type="button">查询</button>
                <button type="submit" class="btn btn-primary" type="button">清空</button>

            </td>
        </tr>
    </table>
</form>

<table class="table table-bordered table-hover definewidth m10" >
    <thead>
    <tr>
        <th><input type="checkbox" id="checkall" onChange="checkall();"></th>
        <th>门诊编号</th>
        <th>患者</th>
        <th>挂号时间</th>
        <th>主治医生</th>
        <th>状态</th>
        <th>操作</th>
    </tr>
    </thead>

    <c:forEach items="${pageUtils.list}" var="registration">
        <tr>
            <td style="vertical-align:middle;"><input type="checkbox" name="check" value="${registration.rid}"></td>
            <td style="vertical-align:middle;">${registration.rid}</td>
            <td style="vertical-align:middle;">${registration.name}</td>
            <td style="vertical-align:middle;">${registration.registerDate}</td>
            <td style="vertical-align:middle;">${registration.dname}</td>
            <td style="vertical-align:middle;">
                <c:if test="${registration.consultation==0}">未挂号</c:if>
                <c:if test="${registration.consultation==1}">已挂号</c:if>
            </td>

            <td style="vertical-align:middle;"><a href="look.html">详情>>></a>&nbsp;&nbsp;&nbsp;<a href="edit.html">更改</a>&nbsp;&nbsp;&nbsp;<a href="javascript:alert('退号成功！');">退号</a></td>
        </tr>

    </c:forEach>

</table>

<table class="table table-bordered table-hover definewidth m10" >
    <tr>
        <th colspan="5">
        <div class="inline pull-right page">
        <a href='${pageContext.request.contextPath}/registrationServlet?mark=selectRegistration&currentPageNo=1&rid=${registrationVo.rid}&dname=${registrationVo.dname}&startTime=${registrationVo.startTime}&endTime=${registrationVo.endTime}' >第一页</a>
        <c:if test="${pageUtils.currentPageNo >1}">
            <a href='${pageContext.request.contextPath}/registrationServlet?mark=selectRegistration&currentPageNo=${pageUtils.currentPageNo-1}&rid=${registrationVo.rid}&dname=${registrationVo.dname}&startTime=${registrationVo.startTime}&endTime=${registrationVo.endTime}'>上一页</a>
        </c:if>
        <c:forEach  var="temp" begin="1"  end="${pageUtils.totalPageSize}">
            <c:if test="${temp==pageUtils.currentPageNo}">
                <a href="${pageContext.request.contextPath}/registrationServlet?mark=selectRegistration&currentPageNo=${temp}&rid=${registrationVo.rid}&dname=${registrationVo.dname}&startTime=${registrationVo.startTime}&endTime=${registrationVo.endTime}"><span class="current">${temp}</span></a>
            </c:if>
            <c:if test="${temp!=pageUtils.currentPageNo}">
                <a href="${pageContext.request.contextPath}/registrationServlet?mark=selectRegistration&currentPageNo=${temp}&rid=${registrationVo.rid}&dname=${registrationVo.dname}&startTime=${registrationVo.startTime}&endTime=${registrationVo.endTime}"><span>${temp}</span></a>
            </c:if>
        </c:forEach>
        <c:if test="${pageUtils.currentPageNo <pageUtils.totalPageSize}">
            <a href='${pageContext.request.contextPath}/registrationServlet?mark=selectRegistration&currentPageNo=${pageUtils.currentPageNo+1}&rid=${registrationVo.rid}&dname=${registrationVo.dname}&startTime=${registrationVo.startTime}&endTime=${registrationVo.endTime}' >下一页</a>
        </c:if>
        <a href='${pageContext.request.contextPath}/registrationServlet?mark=selectRegistration&currentPageNo=${pageUtils.totalPageSize}&rid=${registrationVo.rid}&dname=${registrationVo.dname}&startTime=${registrationVo.startTime}&endTime=${registrationVo.endTime}' >最后一页</a>

        &nbsp;&nbsp;共<span class='current'>${pageUtils.totalPageCount}</span>条记录<span class='current'> ${pageUtils.currentPageNo}/${pageUtils.totalPageSize} </span>页
        </div>
        <div>
            <button type="button" class="btn btn-success" id="newNav">门诊挂号</button>&nbsp;&nbsp;&nbsp;
            <button type="button" class="btn btn-success" id="delPro" onClick="delAll();">退号</button>&nbsp;&nbsp;&nbsp;
            <!--<button type="button" class="btn btn-success" id="delPro">导出Excel</button> -->
        </div>

        </th>
    </tr>
</table>

</body>
</html>